using System;
using System.Collections.ObjectModel;
using Facebook.Entity;
using Facebook.WebControls;

public partial class _Default : CanvasIFrameBasePage
{
	private const string FACEBOOK_API_KEY = "c559128010f3edee33796fd4205361c2";
	private const string FACEBOOK_SECRET = "85887d1c9a8334e5059742468a5400ee";

	protected new void Page_Load(object sender, EventArgs e)
	{
		base.Api = FACEBOOK_API_KEY;
		base.Secret = FACEBOOK_SECRET;
		base.Page_Load(sender, e);

		if (!IsPostBack)
		{
			try
			{
				// Use the FacebookService Component to populate Friends
				User u = FacebookAPI.GetUserInfo();
				Collection<User> f = FacebookAPI.GetFriends();

				string s = "";
				if (f.Count != 1)
				{
					s = "s";
				}

				//Test Get/Set FBML (Profile parameter)
				//lblHelloWorld.Text = "Hello " + u.Name + " you have " + f.Count + " friend" + s + "..." + this.FBService.SessionKey;
				//FacebookAPI.SetFBML("Hello " + u.Name + " you have " + f.Count + " friend" + s, null, null);
				lblHelloWorld.Text = FacebookAPI.GetFBML(FacebookAPI.UserId);
			}
			catch (Exception)
			{
				throw;
			}
		}
	}
}